package com.lkk.util;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.apache.http.client.ClientProtocolException;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.lkk.data.ExcelDataEntity;
import com.lkk.data.ExcelDataException;
import com.lkk.data.Log;
import com.lkk.interaction.RestfulClient;

public class test1 {

	public static void main(String[] args) throws ClientProtocolException, IOException, ExcelDataException {
		RestfulClient rc = new RestfulClient();
		InterfaceUtil iu = new InterfaceUtil();
		Map<String, String> headers = new HashMap<String, String>();
		headers.put("Content-Type", "application/json;charset=UTF-8");
		
		String body = "{\r\n" + 
				"    \"flag\": \"1\",\r\n" + 
				"    \"relation\": \"all\",\r\n" + 
				"    \"query\": \"\",\r\n" + 
				"    \"stoken\":\"5aa89ce3834c4bb49412acef2952d0c1\"\r\n" + 
				"}";
		String url = "http://m2141z3723.imwork.net:36624/eduAttributeKnowledgeGraph";

		ExcelDataEntity exDataEntity = new ExcelDataEntity();
		EntityListUtil entityListUtil =  new EntityListUtil();
		exDataEntity.setBody(body);
		JSONObject jo =  entityListUtil.parserBody(exDataEntity);
		rc.sendRequest("POST","no",headers, jo, url);
		JSONObject responseBody = rc.getResponseBody("no");
		System.out.println(rc.getResponseBody("no").toString());
		Log.info(responseBody.toJSONString());
	}
}
